New imaging modalities such as functional magnetic resonance imaging (fMRI) have helped advance our understanding of human brain function. Researchers are interested in using these techniques to study both effects of external stimuli on human brain function and causal relations among different brain regions. The concern with causal issues has prompted much work, with empirical researchers applying various statistical procedures (e.g., Granger causality, dynamic causal models, structural equation and directed graphical models) to fMRI data and interpreting the resulting associations as effects, often inappropriately. This is a major problem for a field where causation occupies center stage. Building on the idea that causal relationships sustain counterfactual conditional statements, we use potential outcomes notation, widely used in the statistical literature, to develop a basic framework for causal inference in fMRI research. We also extend the statistical literature on mediation, which mostly takes up the case of a treatment, a single mediator and a single response, to the case of multiple functional mediators. In addition to helping push the field of functional neuroimaging forward, we contribute to the research on causal inference, functional data analysis and longitudinal data analysis. We develop methods for causal inference with high dimensional data, applying these to fMRI data from studies of post-traumatic stress disorder, thermal pain and social evaluation.